<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        header {
            display: flex;
            justify-content: space-between;
            background: rgb(41, 128, 185);
            color: #fff;
            padding: 20px;
        }

        section {
            display: flex;
        }

        section aside {
            width: 100px;
            background: rgb(41, 128, 185);
            color: #fff;
            text-align: center;
            line-height: 40px;
        }

        aside div:nth-child(3) {
            background: rgb(31, 97, 141);
        }

        section .box {
            padding: 30px;
        }

        section .box input {
            width: 300px;
            padding: 15px;
            border-radius: 10px;
            border: 1px solid #999;
        }

        .box button {
            background: rgb(93, 184, 91);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 15px;
            margin: 10px;
        }

        .box1 button {
            background: rgb(93, 184, 91);
            color: #fff;
            border: none;
            border-radius: 10px;
            padding: 15px;
            margin: 0 30px;
        }

        main {
            flex: 1;
            padding: 20px;
        }

        section main table {
            margin: 20px 0;
            width: 100%;
            line-height: 50px;
            text-align: center;

        }

        table tr th:first-child,
        main table tr td:first-child {
            text-align: left;
        }

        table tr th {
            max-width: 200px;
        }

        table button {
            border-radius: 10px;
            padding: 10px;
            border: none;

        }

        table .btn {
            background: rgb(93, 184, 91);
            color: #fff;
        }

        .box2 {
            line-height: 40px;
            text-align: center;

        }

        .box2 button {
            padding: 10px 30px;
            border-radius: 10px;
        }
    </style>
</head>

<body>
    <header>
        <span>9466云专题</span>
        <span>龙猫（9466云专题）</span>
    </header>
    <section>
        <aside>
            <div>首页</div>
            <div>专题</div>
            <div>用户</div>
            <div>设置</div>
            <div>日志</div>
        </aside>
        <main>
            <div class="box"><input type="text" placeholder="搜索用户"><button>搜索</button></div>
            <div class="box1"><button>+添加用户</button></div>
            <table>
                <thead>
                    <tr>
                        <th>邮箱(用户)</th>
                        <th>姓名</th>
                        <th>电话</th>
                        <th>所属组</th>
                        <th>管理员</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>3rwrwe@sina.com</td>
                        <td>李彦宏888</td>
                        <td>1999923233</td>
                        <td>编辑2</td>
                        <td>是</td>
                        <td> <button class="btn">正常</button> </td>
                        <td> <button>编辑</button> <button>删除</button> </td>
                    </tr>
                    <tr>
                        <td>2342342@sina.cm</td>
                        <td>马化腾</td>
                        <td>12199292992</td>
                        <td>编辑2</td>
                        <td>是</td>
                        <td> <button class="btn">正常</button> </td>
                        <td> <button>编辑</button> <button>删除</button> </td>
                    </tr>

                </tbody>
            </table>
            <div class="box2">
                <button>上一页</button>
                <button>下一页</button>
            </div>
        </main>

    </section>
</body>

</html>
<script src="./promise-ajax.js"></script>
<script src="./mock.js"></script>
<script src="./mockdata.js"></script>
<script>
    render(data.list)

    //渲染表格数据
    function render(data) {
        var str = data.map((item, index) => {
            return `<tr>
                    <td>${item.email}</td>
                    <td>${item.name}</td>
                    <td>${item.phone}</td>
                    <td>${item.ingroup}</td>
                    <td>${item.isadmin?'是':'否'}</td>
                    <td> <button class="btn">${item.status?'正常':'异常'}</button> </td>
                    <td> <button>编辑</button> <button>删除</button> </td>
                </tr>`
        }).join('')
        document.querySelector('tbody').innerHTML = str;
    }
</script>